package se.webbzon.boltzmann.minigame.menu;

import java.awt.Image;

import se.webbzon.boltzmann.configuration.Graphics;
import se.webbzon.boltzmann.hud.AbstractHudLayout;
import se.webbzon.boltzmann.resource.Resources;
import se.webbzon.oschi01.resourceset.ResourceSet;

public class DefaultMenuLayout extends AbstractHudLayout implements MenuLayout {
	
	// The size and offset
	private final int width, height, xOffset, yOffset;
	
	// the offset, size and spacing of the buttons
	private final int buttonXOffset, buttonYOffset;
	private final int buttonWidth, buttonHeight;
	private final int buttonSpacing;
	
	// The background image
	private final Image background;
	
	// The buttons
	private final ResourceSet<Image> exit, home, info, play, question, left, right;
	
	/*============================================================
	Constructors
	============================================================*/
	
	public DefaultMenuLayout() {
		background = Resources.getImageSet("minigame_button_bar_48p").get(0);
		exit = Resources.getImageSet("minigame_exit_button");
		home = Resources.getImageSet("minigame_home_button");
		info = Resources.getImageSet("minigame_info_button");
		play = Resources.getImageSet("minigame_play_button");
		question = Resources.getImageSet("minigame_question_button");
		left = Resources.getImageSet("arrow_left_32p");
		right = Resources.getImageSet("arrow_right_32p");
		buttonXOffset = 64;
		buttonYOffset = -32;
		buttonWidth = buttonHeight = 64;
		buttonSpacing = 8;
		width = 480;
		height = 480;
		switch (Graphics.instance().getResolution()) {
		case HIGH:
			xOffset = 400;
			yOffset = 672;
			break;
		case MEDIUM:
			xOffset = 240;
			yOffset = 492;
			break;
		default:
			xOffset = 80;
			yOffset = 312;
		}
	}
	
	/*============================================================
	Public Methods
	============================================================*/
	
	@Override public int getWidth() {
		return width;
	}

	@Override public int getHeight() {
		return height;
	}
	
	@Override public int getXOffset() {
		return xOffset;
	}
	
	@Override public int getYOffset() {
		return yOffset;
	}
	
	@Override public int getButtonXOffset() {
		return buttonXOffset;
	}

	@Override public int getButtonYOffset() {
		return buttonYOffset;
	}
	
	@Override public int getButtonWidth() {
		return buttonWidth;
	}

	@Override public int getButtomHeight() {
		return buttonHeight;
	}

	@Override public int getButtonSpacing() {
		return buttonSpacing;
	}

	@Override public Image getBackground() {
		return background;
	}

	@Override public ResourceSet<Image> getExitButton() {
		return exit;
	}
	
	@Override public ResourceSet<Image> getHomeButton() {
		return home;
	}

	@Override public ResourceSet<Image> getInfoButton() {
		return info;
	}

	@Override public ResourceSet<Image> getPlayButton() {
		return play;
	}

	@Override public ResourceSet<Image> getQuestionButton() {
		return question;
	}

	@Override public ResourceSet<Image> getArrowLeft() {
		return left;
	}

	@Override public ResourceSet<Image> getArrowRight() {
		return right;
	}

}
